<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//Route::group(mid);

Route::get('/show',function (){
    return view('info.show');
});
if(ismobile()){
    Route::get('/home/{code}', 'HomeController@index2');
    Route::get('/', 'HomeController@index2');
}else{
    Route::get('/home/{code}', 'HomeController@index');
    Route::get('/', 'HomeController@index');
}

//Route::get('/home/{code}', 'HomeController@index');

Route::any('/openid/store', 'HomeController@store');

Route::any('/dd', 'TestController@test');


Route::get('/test', 'TestController@index');
Route::get('/import', 'TestController@import');
Route::any('/aaa', 'TestController@aaa');

Route::get('/demo', 'DemoController@index');

Route::group(['middleware' => ['web']], function () {
    Route::get('/welcome','AgentController@index');
    Route::any('/sendsms','HomeController@sendsms');
    Route::group(['prefix' => 'agent'], function () {
        Route::get('/', 'AgentController@index');
        Route::get('/index', 'AgentController@index');
        Route::any('/add', 'AgentController@create');
        Route::any('/agentlist/{id}', 'AgentController@agentlist');
    });
    Route::group(['prefix' => 'income'],function (){
        Route::get('/','InComeController@index');
    });
    Route::group(['prefix' => 'customer'], function () {
        Route::get('/','CustomerController@index');
        Route::get('/index', 'CustomerController@index');
        Route::any('/upgrade/{id}', 'CustomerController@upgrade');
        Route::any('/list/{id}', 'CustomerController@lists');
    });

    Route::get('/info','InfoController@index');
    Route::post('/info','InfoController@update');


    /**
     * 登录
     */
    Route::get('/login', 'LoginController@login');
    Route::post('/login', 'LoginController@postLogin');
    Route::get('/logout', function () {
        session()->flush();
        return redirect('/login');
    });
});
